import axios from "axios";

// process.env.NODE_ENV === "development"
let config = {};
if (process.env.NODE_ENV !== "development") {
  config = {
    baseURL: process.env.VUE_APP_BASE_API, // 配置API接口地址
    // withCredentials: true // send cookies when cross-domain requests
    // timeout: 5000 // request timeout
  };
}

// axios.defaults.withCredentials = true;

const service = axios.create(config);

service.interceptors.response.use(
  (response) => {
    return response;
  },
  (error) => {
    // 警告通知
    // Notify({
    //   type: 'warning',
    //   message: error.message || '网络错误，请稍后再试'
    // })
    return Promise.reject(error);
  }
);

export default service;
